package com.soft.service;

import com.soft.dao.WorkDaoImpl;
import com.soft.pojo.Emp;
import com.soft.utils.Result;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ruoxi
 * @create 2021-12-25 19:04
 */
public class WorkService {
    private WorkDaoImpl workDao = new WorkDaoImpl();

    public ArrayList<Emp> findEmpByPage(int currentPage,int currentCount) {
        return (ArrayList<Emp>) workDao.selectEmpByPage(currentPage,currentCount);
    }

    public int findEmpCount(){
        return workDao.selectByAll().size();
    }

    public Result findEmpByEno(String eno){
        List<Emp> empList = workDao.selectByEno(eno);
        if (empList.size()>0){
            return Result.me(empList.get(0));
        }
        return Result.me(null);
    }

    public Emp findEmpByIntEno(int eno){
        return workDao.selectByIntEno(eno).get(0);
    }
}
